<?php
########################################################
# DMS Donations Management System v1.0                 #
# created by:  Isaac Sabas                             #
#                                                      #
# De La Salle Philippines                              #
# All Rights Reserved DLSP Copyright 2009              #
########################################################

define('START', true);	

session_start();	
	
# set error checking levels #	
	# enable these lines when site is to be deployed #	
	ini_set('error_reporting', E_ALL);
    ini_set('display_errors', 'On');
    //ini_set('log_errors', 'On');
    //ini_set('error_log', '/usr/local/apache/logs/error_log');
	
# include some needed files #
	# include some needed files #
	include('lib/XAJAX/xajax_core/xajax.inc.php');
	
# instantiate predifined classes #											
	$xajax = new xajax();

	$xajax->registerFunction("doAdd");
	$xajax->registerFunction("doReset");
	
	function doAdd($a, $b)
	{
		$response = new xajaxResponse();
		$response->assign('answer', 'innerHTML', $a + $b);
		$response->assign('reset', 'style.display', 'block');
		return $response;
	}

	function doReset()
	{
		$response = new xajaxResponse();
		$response->clear('answer', 'innerHTML');
		$response->assign('reset', 'style.display', 'none');
		return $response;
	}
	
	$xajax->processRequest();	
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
	<title>xajax test</title>
	
	<script type="text/javascript" src="lib/XAJAX/xajax_js/xajax_core.js" />
	<?php $xajax->printJavaScript(); ?>
</head>

<body>
	
<form action="#" method="post">
	<input type="button" onclick="xajax_doAdd(1,6)" id="btnAdd" value="Click Me" />
	<input type="button" onclick="xajax_doReset()" id="btnReset" value="Reset" />
	<p id="answer"></p>
</form>

</body>
</html>
